﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Waiter.Common;

namespace Waiter.View
{
    public partial class frmBillDetail : DevComponents.DotNetBar.Office2007Form
    {
        public frmBillDetail()
        {
            InitializeComponent();
        }

        private string billCode;
        public void fsSetBillCode(string code)
        {
            billCode = code;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmBillDetail_Load(object sender, EventArgs e)
        {
            CommonLogging.fsWriteLog(CommonConstants.LOG_TYPE_INFO, "frmBillDetail.frmBillDetail_Load", "", "");

            List<ORDER_COUPON_D> orderCouponDList = CommonGlobalVariable.globalDataContext.BILLs
                .FirstOrDefault(q => q.CODE == billCode)
                .ORDER_COUPON.ORDER_COUPON_Ds.ToList();
            if (orderCouponDList == null || orderCouponDList.Count == 0)
            {
                return;
            }

            this.dgrDetail.Rows.Add(orderCouponDList.Count);
            for (int i = 0; i < orderCouponDList.Count; i++)
            {
                this.dgrDetail.Rows[i].Cells["colSTT"].Value = i + 1;
                this.dgrDetail.Rows[i].Cells["colMenu"].Value = orderCouponDList[i].MENU.DRINKS_NAME;
                this.dgrDetail.Rows[i].Cells["colPrice"].Value = orderCouponDList[i].PRICE;
                this.dgrDetail.Rows[i].Cells["colCount"].Value = orderCouponDList[i].COUNT;
            }

        }
    }
}
